<?php
/** @var yii\data\ArrayDataProvider $dataProvider */
/** @var array $openids */
use yii\helpers\Html;
use yii\helpers\Url;

$this->title = '用户';
$this->params['breadcrumbs'][] = $this->title;
?>
<p class="text-right">
    <?= Html::a('批量移动用户分组', ['batch-change-group'], ['class' => 'btn btn-primary']) ?>
</p>
<table class="table table-bordered">
    <thead>
    <tr>
        <th>openid</th>
        <td></td>
    </tr>
    </thead>
    <tbody>
    <?php foreach ($openids as $openid): ?>
        <tr>
            <td><?= $openid ?></td>
            <td><?= Html::a('<i class="glyphicon glyphicon-eye-open"></i>', ['view', 'openid' => $openid], ['title' => '查看用户信息']) ?>
            <?= Html::a('<i class="glyphicon glyphicon-pencil"></i>', ['update-remark', 'openid' => $openid], ['title' => '更新用户备注名']) ?>
            </td>
        </tr>
    <?php endforeach; ?>
    </tbody>
</table>
<p>total: <?= $total ?> count: <?= $count ?> next_openid: <?= $nextOpenid ?></p>

<?php
echo \yii\grid\GridView::widget([
    'dataProvider' => $dataProvider,
    'columns' => [
        'openid',
        'nickname',
        [
            'attribute' => 'headimgurl',
            'format' => 'raw',
            'content' => function($model) {
                return Html::img($model['headimgurl'], ['width' => 100, 'height' => 100]);
            }
        ],
        [
            'class' => \yii\grid\ActionColumn::className(),
            'template' => '{view} {update-remark} {change-group} ',
            'buttons' => [
                'view' => function($url, $model, $key) {
                    return Html::a('<i class="glyphicon glyphicon-eye-open"></i>', ['view', 'openid' => $model['openid']], ['title' => '更新']);
                },
                'update-remark' => function($url, $model, $key) {
                    return Html::a('<i class="glyphicon glyphicon-pencil"></i>', ['update-remark', 'openid' => $model['openid']], ['title' => '更新用户备注名']);

                },
                'change-group' => function($url, $model, $key) {
    return Html::a('移动用户分组', ['change-group', 'openid' => $model['openid']], ['title' => '移动用户分组']);

}
            ]
        ]
    ]
]);
